package com.mud.dnd.domain.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.codehaus.jackson.annotate.JsonIgnore;

@Entity
public class User implements Serializable {
	
	
	
	public enum Role
	{
		Admin,
		User
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	int id;
	private String name;
	private String password;
	private Role role;
	
	
	
	
	
	
	public User() {
		
	}
	
	public User( String name, String password, Role role) {
		
		this.name = name;
		this.password = password;
		this.role = role;
	}
	
	@Id
	@GeneratedValue
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	@Pattern(regexp="[a-zA-Z0-9]*")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@JsonIgnore
	@Pattern(regexp="[a-zA-Z0-9]*")
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	@JsonIgnore
	@Enumerated(EnumType.STRING)
	public Role getRole() {
		return role;
	}
	public void setRole(Role role) {
		this.role = role;
	}

	
	
	
	
	
	
	
	
	

}
